package com.tianyuan.dplrf.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatTextView;

import com.hjq.base.BaseAdapter;
import com.tianyuan.dplrf.R;
import com.tianyuan.dplrf.app.AppAdapter;
import com.tianyuan.dplrf.ui.bean.Ncjt_tianqibean;


public class Ncjt_tianqiAdapter extends AppAdapter<Ncjt_tianqibean> {

    public Ncjt_tianqiAdapter(@NonNull Context context) {
        super(context);
    }


    @NonNull
    @Override
    public BaseAdapter<?>.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolde();
    }

    private final class ViewHolde extends ViewHolder{
        private AppCompatTextView tv_name;
        private AppCompatTextView tv_danw;
        private AppCompatTextView tv_data;
        private AppCompatTextView tv_ct;

        public ViewHolde() {
            super(R.layout.item_fragment_ncjttianqii);
            initview(getItemView());
        }

        @Override
        public void onBindView(int position) {
            Ncjt_tianqibean item = getItem(position);
            tv_name.setText(item.getName());
            tv_danw.setText("单位：" + item.getDanweil());
            tv_data.setText(item.getData());
            if (!item.getCatz().equals("")){
                tv_ct.setText(item.getName());
            }

        }

        private void initview(View getItemview) {
            tv_name = getItemview.findViewById(R.id.tv_name);
            tv_danw = getItemview.findViewById(R.id.tv_danw);
            tv_data = getItemview.findViewById(R.id.tv_data);
            tv_ct = getItemview.findViewById(R.id.tv_ct);
        }
    }
}